package com.igeek.d0531;

import java.util.LinkedList;

/**
 * @Author: zhiyu
 * @Date:17:59
 * @DESC:
 */
public class LinkedListDemo {
    public static void main(String[] args) {
       forPerson(getPeople());
       simulate();
    }
    public static LinkedList<Person> getPeople(){
        Person person1 = new Person("1", 23);
        Person person2 = new Person("2", 22);
        Person person3 = new Person("3", 21);
        Person person4 = new Person("4", 23);
        LinkedList<Person> people = new LinkedList<>();
        people.add(person1);
        people.add(person2);
        people.add(person3);
        people.add(person4);
        return people;
    }
    public static void forPerson(LinkedList<Person> people){
        for (Person p : people) {
            System.out.println(p);
        }
    }
    public static void simulate(){
        LinkedList<Person> people = new LinkedList<>();
        people.push(new Person("1",20));
        people.push(new Person("2",21));
        people.push(new Person("3",22));
        System.out.println("people.pop() = " + people.pop());
        System.out.println("people.pop() = " + people.pop());
        System.out.println("people.pop() = " + people.pop());
    }
}
